<?php
/**
 * User: YL
 * Date: 2019/6/10
 */

namespace restful\traits;

use restful\utils\Redis;
use restful\utils\RedisNoPrefix;

trait RedisHandle
{
    /**
     * 获取redis句柄
     * @return \Predis\Client
     */
    protected function getRedisHandle()
    {
        return Redis::getInstance()->getConnect();
    }

    /**
     * 获取缓存前缀
     * @return string
     */
    protected function getRedisPrefix()
    {
        return Redis::getInstance()->getPrefix();
    }

    /**
     * 获取没有前缀的redis句柄
     * @return \Predis\Client
     */
    protected function getNoPrefixRedisHandle()
    {
        return RedisNoPrefix::getInstance()->getConnect();
    }
}